﻿using MiniFox.Components;
using MiniFox.Platform.File.Configurations;
using MiniFox.Platform.File.Providers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MiniFox.Platform.File.Services
{
    /// <summary>
    /// 
    /// </summary>
    [AutoRegister, SpareComponent(typeof(ConfigurationService))]
    public interface IConfigurationService
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        object GetConfiguration();
    }

    internal class ConfigurationService : IConfigurationService
    {
        [AutoWired]
        internal IFileSystemConfigurationProvider Provider { get; set; }

        public object GetConfiguration()
        {
            var config = Provider.GetConfiguration();
            return new 
            {
                defaultGroup = config.DefaultFileSetting,
                data = config.FileSettings 
            };
        }
    }
}
